// Article
import {request} from "@/utils/request.ts";

export async function articleSaveReq(
    body: Partial<API.ArticleSaveReq>,
    options?: { [p: string]: never }
) {
    return request<BaseResp<API.ArticleSaveResp>>({
        url: `/api/v1/admin/resource/article/save`,
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

export async function articleListReq(
    body: Partial<API.ArticleListReq>,
    options?: { [p: string]: never }
) {
    return request<BaseResp<API.ArticleListResp>>({
        url: `/api/v1/admin/resource/article/list`,
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

export async function articleDeleteReq(
    body: Partial<API.ArticleDeleteReq>,
    options?: { [p: string]: never }
) {
    return request<BaseResp<API.ArticleDeleteResp>>({
        url: `/api/v1/admin/resource/article/delete`,
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

export async function articleSaveTagReq(
    body: Partial<API.ArticleSaveTagReq>,
    options?: { [p: string]: never }
) {
    return request<BaseResp<API.ArticleSaveTagResp>>({
        url: `/api/v1/admin/resource/article/save/tag`,
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

// Tag
export async function tagListReq(
    body: Partial<API.TagListReq>,
    options?: { [p: string]: never }
) {
    return request<BaseResp<API.TagListResp>>({
        url: `/api/v1/admin/resource/tag/list`,
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

